// pages/component/home/home.js
import routerManager from '../../../utils/routerManager.js'
import http from "../../../utils/http";
Component({
  /**
   * 组件的属性列表
   */
  properties: {
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached: function () {
      console.log('attached');
    },
    moved: function () {
      console.log('moved');
    },
    detached: function () {
      console.log('moved');
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    masters:[],
    triggered:false
  },
  ready:function(){
    let that = this;
    http.customerIndex(0, 100,function(res){
      that.setData({
        masters:res.data.list
      });
    });
  },
  /**
   * 组件的方法列表
   */
  methods: {
    select: function (e) {
      this.setData({
        selectVal: e.detail
      })
    },
    toDetail:function(event){
      let fid = event.currentTarget.dataset.fid;
      routerManager.toFortunetellerDetail(fid);
    },
    bindrefresherpulling:function(e){
      let that = this;
      http.customerIndex(0, 100,function(res){
        that.setData({
          masters:res.data.list,
          triggered:false
        });
      });
    }
  }
})
